package util;

import org.apache.batik.dom.events.DOMMouseEvent;
import org.w3c.dom.events.Event;

import svg.BoardAdapter;
import svg.GameController;

/**
 * Class to handle all events related to the retry button.
 */
public class RetryListener extends ObjectListener
{

	public RetryListener(GameController controller, BoardAdapter boardAdapter)
	{
		super(controller, boardAdapter);
	}

	@Override
	public void fire(Event evt)
	{
		DOMMouseEvent event = (DOMMouseEvent) evt;
		String eventType = event.getType();
		
		if (eventType.equals(EventType.CLICK.toString()))
		{
			_controller.clickRetry();
		}
		else
		{
			 throw new IllegalArgumentException("No valid EventType: " + eventType);
		}
	}

}
